package com.atguigu.gmall;

import com.atguigu.gmall.common.constant.RedisConst;
import org.mybatis.spring.annotation.MapperScan;
import org.redisson.api.RBloomFilter;
import org.redisson.api.RedissonClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;

/**
 * ClassName: ProductApp
 * Package: com.atguigu.gmall
 * Description:
 *
 * @Author 刘轩
 * @Create 2023-08-15 20:06
 * @Version 1.0
 */

@SpringBootApplication
@EnableDiscoveryClient
public class ProductApp  implements CommandLineRunner{


 public static void main(String[] args) {
  SpringApplication.run(ProductApp.class, args);
 }

 @Autowired
 private RedissonClient redissonClient;

 // 初始化方法
 @Override
 public void run(String... args) throws Exception {
  RBloomFilter<Object> bloomFilter = redissonClient.getBloomFilter(RedisConst.SKU_BLOOM_FILTER);
  // 初始化数据规模与误判率
  bloomFilter.tryInit(1000000,0.0000001);
 }
}
